package com.tbs.easyhomemoneyserver.service

import com.tbs.easyhomemoneyserver.DO.FlowNode
import com.tbs.easyhomemoneyserver.DO.FlowTemplate

interface IFlowService {
    interface IFlowWork {
        /**
         * 执行成功
         *
         * @param node
         * @param template
         */
        fun success(node: FlowNode, template: FlowTemplate) {
        }

        val nodeParam: Any?
            get() = null
    }

    /**
     * 根据模板id启动流程
     *
     * @param templateId
     * @param flowWork
     * @return
     */
    fun beginFlow(templateId: Long, flowWork: IFlowWork?): FlowNode?


    /**
     * 结束当前节点
     *
     * @param nodeId
     * @param work
     * @return
     */
    fun finishNode(nodeId: Long, work: IFlowWork?): FlowNode?


    /**
     * 设置节点的值
     *
     * @param nodeId
     * @param intValue
     * @param textVal
     * @return
     */
    fun setNodeValue(nodeId: Long, intValue: Int?, textVal: String?): FlowNode?
}
